#include <stdio.h>

int search_k(int arr[3][3],int k,int *px,int *py)
{
    int x = 0;
    int y = *py-1;
    while(x<=*px-1 && y>=0)
    {
        if(arr[x][y]<k)
            x++;
        else if(arr[x][y]>k)
            y--;
        else
        {
            *px = x;
            *py = y;
            return 1;
        }
    }
    return 0;
}

int main()
{
    int arr[3][3] = {1,2,3,4,5,6,7,8,9};
    int k = 5;
    int x = 3;
    int y = 3;
    int ret = search_k(arr,k,&x,&y);//关键&x&y，地址是不变的，通过修改函数内部的*px，*py就可以影响外面的x，y
    if(ret==1)
        printf("FIND,%d %d",x,y);
    else
        printf("Not find.");
    return 0;
}
